package core.match;

import core.game.Game;
import core.game.timer.GameTimer;
import core.game.timer.TimerFactory;
import core.game.ui.GameUI;
import core.game.ui.UiFactory;
import core.player.Player;
import java.util.ArrayList;

public class Match {
    private final int gameNumbers;
    private final ArrayList<Thread> games;
    private final Player one;
    private final Player another;

    public Match(int gameNumbers, Player one, Player another) {
        this.gameNumbers = gameNumbers;
        this.one = one;
        this.another = another;
        this.games = new ArrayList(gameNumbers);
    }

    public void process() {
        Player black = this.one;
        Player white = this.another;

        for(int i = 0; i < this.gameNumbers; ++i) {
            Player temp;
            try {
                temp = (Player)black.clone();
                Player wClone = (Player)white.clone();
                Game game = new Game(temp, wClone);
                this.games.add(game.start());
            } catch (Exception var7) {
                var7.printStackTrace();
            }

            temp = black;
            black = white;
            white = temp;
        }

    }

    public ArrayList<Thread> getGames() {
        return this.games;
    }
}
